﻿

using System;
using System.Collections.Generic;

namespace DSAManager.Models.Output
{
    public class PageEntity<T>
    {
        public PageEntity()
        {
            Records=new List<T>();
        }

        public long PageNo { get; set; }
        public long RecordCount { get; set; }
        public long PageSize { get; set; }
        public List<T> Records { get; private set; }

        public long PageCount
        {
            get
            {
                return (int)Math.Ceiling(((double)RecordCount / PageSize));
            }
        }

        public long Begin
        {
            get { return PageSize * (PageNo - 1) + 1; }
        }

        public long End
        {
            get
            {
                return Math.Min(RecordCount, PageSize * PageNo);
            }
        }
    }
}
                                